package com.si.control;

import com.si.control.action.IAction;
import com.si.control.action.SetConstantAction;
import com.si.ui.enumn.EConfigMenu;
import com.si.ui.enumn.EConstant;

public class ConfigurationHandler extends ActionHandler<EConfigMenu> {
	
	private IAction<EConstant, Object> setConstantAction;
	
	public ConfigurationHandler() {
		this.setConstantAction = new SetConstantAction();
	}

	@Override
	protected void handle(final EConfigMenu command) {
		if(command == null) return;
		try {
			switch(command) {
			case Randomness: this.setConstantAction.perform(EConstant.Randomness); break;
			case ResultPerWord: this.setConstantAction.perform(EConstant.ResultPerWord); break;
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	@Override
	protected EConfigMenu parse(final String str) {
		return EConfigMenu.valueOf(str);
	}
}
